package org.myhomework.entity;

import java.sql.ResultSet;
import java.sql.SQLException;

public class Teacher {

    private Integer id;
    private String name;
    private String sex;
    private Integer age;
    private String course;
    private String school;

    private Integer userId;

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }



    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getCourse() {
        return course;
    }

    public void setCourse(String course) {
        this.course = course;
    }

    public String getSchool() {
        return school;
    }

    public void setSchool(String school) {
        this.school = school;
    }


    public static Teacher mapResult(ResultSet resultSet) throws SQLException {
        Teacher teacher = new Teacher();
        teacher.setId(resultSet.getInt("id"));
        teacher.setName(resultSet.getString("name"));
        teacher.setSex(resultSet.getString("sex"));
        teacher.setAge(resultSet.getInt("age"));
        teacher.setCourse(resultSet.getString("course"));
        teacher.setSchool(resultSet.getString("school"));
        teacher.setUserId(resultSet.getInt("user_id"));
        return teacher;
    }

}
